﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Add.aspx.cs" Inherits="BuXiaChu.OrderDishes.Web.Admin.Restaurant.Add" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register TagPrefix="Menu" TagName="Header" Src="~/Modules/Menu/Header.ascx" %>
<%@ Register TagPrefix="Menu" TagName="Footer" Src="~/Modules/Menu/Footer.ascx" %>
<%@ Register TagPrefix="Menu" TagName="CityLeft" Src="~/Modules/Menu/CityLeft.ascx" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link media="screen, projection" rel="stylesheet" type="text/css" href="/css/Blueprint/screen.css" />
    <link media="screen, projection" rel="stylesheet" type="text/css" href="/css/main.css" />

    <script type="text/javascript" src="../js/Extend.js"></script>

    <script type="text/javascript" src="../js/Common.js"></script>

    <script type="text/javascript" src="../js/jquery-vsdoc.js"></script>

</head>
<body>
    <div class="container">
        <Menu:Header ID="Header1" runat="server" />
        <form id="form1" runat="server">
        <Menu:CityLeft ID="menu_CityLeft" runat="server" />
        <div class="span-20 last">
            <div class="boxc">
                <a href="Index.aspx">返回餐厅管理</a>
            </div>
            <div class="editor">
                <div class="label">
                    所属城市</div>
                <div class="field">
                    <select runat="server" id="sel_City">
                    </select>
                </div>
                <div class="label">
                    <span class="notice">*</span> 所属区域</div>
                <div class="field">
                    <select id="sel_Area">
                    </select>
                    <input type="hidden" runat="server" id="txt_AreaId" />
                </div>
                <div class="label">
                    <span class="notice">*</span>餐厅名称</div>
                <div class="field">
                    <input type="text" runat="server" id="txt_Name" />
                </div>
                <div class="label">
                    <span class="notice">*</span>餐厅类别</div>
                <div class="field">
                    <select runat="server" id="sel_Cat">
                    </select>
                </div>
                <div class="label">
                    <span class="notice">*</span>餐厅地址</div>
                <div class="field">
                    <input type="text" runat="server" id="txt_Address" />
                </div>
                <div class="label">
                    <span class="notice">*</span>门店电话</div>
                <div class="field">
                    <input type="text" runat="server" id="txt_Tel" />
                </div>
                <div class="label">
                    <span class="notice">*</span>餐厅联系人1</div>
                <div class="field">
                    <input type="text" runat="server" id="txt_Contact1" />
                </div>
                <div class="label">
                    <span class="notice">*</span>联系人电话1</div>
                <div class="field">
                    <input type="text" runat="server" id="txt_Tel1" />
                </div>
                <div class="label">
                    餐厅联系人2</div>
                <div class="field">
                    <input type="text" runat="server" id="txt_Contact2" />
                </div>
                <div class="label">
                    联系人电话2</div>
                <div class="field">
                    <input type="text" runat="server" id="txt_Tel2" />
                </div>
                <div class="label">
                    网址</div>
                <div class="field">
                    <input type="text" runat="server" id="txt_Website" />
                </div>
                <div class="label">
                    备注</div>
                <div class="field">
                    <textarea runat="server" id="txt_Remarks" style="width: 300px; height: 80px"></textarea>
                </div>
                <div class="label">
                    &nbsp;</div>
                <div class="field">
                    <input type="submit" id="btn_Save" value="保存" /></div>
            </div>
        </div>
    </div>
    </form>
    <Menu:Footer ID="Footer1" runat="server" />
    </div>
</body>
</html>

<script type="text/javascript" src="../js/FormValid.js"></script>

<script type="text/javascript">

    (function() {
        fillAreaList();
        $(jDoc("sel_Area")).bind("change", function() {
            jDoc("txt_AreaId").value = this.options[this.selectedIndex].value;
        })
        ElementValidator.className.error = "error";
        var formValidator = new ElementValidator();
        formValidator.addSelect({ id: "sel_Area", len: { text: /^[0]{1}$/, errorMsg: "请选择所属区域"} });
        formValidator.addText({ id: "txt_Name", focus: "请输入餐厅名称", defTips: "餐厅名称必填", len: { text: /^.{2,50}$/, errorMsg: "餐厅名称需要2-20个字"} });
        formValidator.addText({ id: "txt_Address", defTips: "餐厅名称必填", len: { text: /^.{3,50}$/, errorMsg: "餐厅地址需要3-50个字"} });
        formValidator.addText({ id: "txt_Tel", defTips: "电话必填", len: { text: /^\d{7,8}$/, errorMsg: "电话填写错误 只能填写数字"} });
        formValidator.addText({ id: "txt_Tel1", defTips: "联系人电话1必填", len: { text: /^\d{7,11}$/, errorMsg: "联系人电话1填写错误 只能填写数字"} });
        formValidator.addText({ id: "txt_Contact1", defTips: "餐厅联系人1必填", len: { text: /^.{1,20}$/, errorMsg: "餐厅联系人1需要1-20个字"} });
        formValidator.addText({ id: "txt_Tel2", reg: { text: /^\d{0,20}$/, errorMsg: "联系人电话2填写错误 只能填写数字"} });
        $(jDoc("btn_Save")).bind("click", function() {
            return formValidator.validate();
        })
    })();
</script>

<script type="text/javascript">
    if ("<%=message %>" == "ok") {
        alert("操作成功");
    } else if ("<%=message %>" == "fail") {
        alert("操作失败");
    }
</script>

